<?php get_header(); 
$album_id = get_query_var('album_id');
if(empty($album_id)) {
	global $wpdb;
	$album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->nggalbum",''));
	$album_id = $album->id;
}

?>
<script type="text/javascript">
	$('.header').addClass('gallery');
</script>
<script src="<?php echo bloginfo('template_url'); ?>/js/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="<?php echo bloginfo('template_url'); ?>/js/jquery.jcarousel.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_url'); ?>/css/skins/tango/skin.css" />
<div class="row visible-lg">
    		<div class="col-sm-6 col-lg-6 col-12 mt60 slideleft">
    			<div class="hidden-sm">
    				<ul id="mycarousel" class="jcarousel-skin-tango" style="display:none;">
    					 <?php 
	                    $album = nggdb::find_album($album_id);
	                    foreach($album->gallery_ids as $gallery_id){
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							$gallery = nggdb::find_gallery( $gallery_id ); 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
	                        ?>
		                	 <li><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"  /></a></li>
	                    <?php } ?>
		            </ul>
    				<img class="khung-bst" src="<?php echo bloginfo('template_url'); ?>/img/slider-left.png" style="width:130%;display:none;">
    			</div>
    			<div>
	    			<div id="carousel-example-generic" data-interval="false" class="carousel slide col-lg-11 col-sm-11 pull-right text-center gallery-sm">
					  <!-- Wrapper for slides -->
					  <div class="carousel-inner">
					  <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i<2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item <?php if($i==2){ ?>active<?php } ?>">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						      <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						      <div class="visible-sm">
						      	<img src="<?php echo $imgpath; ?>">
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
	                    <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i>=2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						       <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						       <div class="visible-sm">
						      	<a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"></a>
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
					  </div>

					  <!-- Controls -->
					  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
					    <span class="icon-prev"></span>
					  </a>
					  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
					    <span class="icon-next"></span>
					  </a>
					</div> 
                </div>
    		</div>
    		<div class="col-sm-6 col-lg-6 col-12 hidden-sm">
    			<div class="col-lg-3 col-sm-3">
    				<img src="<?php echo bloginfo('template_url'); ?>/img/human4.png">
    			</div>
    			<div class="col-lg-1 col-sm-2"></div>
    			<div class="col-lg-8 col-sm-7 mt60 slideright">
    				<ul id="mycarousel2" class="jcarousel-skin-tango" style="display:none;">
		                 <?php 
	                    $album = nggdb::find_album($album_id);
	                    foreach($album->gallery_ids as $gallery_id){
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							$gallery = nggdb::find_gallery( $gallery_id ); 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
	                        ?>
		                	 <li><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"  /></a></li>
	                    <?php } ?>
		            </ul>
    				<img src="<?php echo bloginfo('template_url'); ?>/img/slider-right.png">
    				<div class="cls-bst-nav">
							<?php 
							global $wpdb;
							$album = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->nggalbum",'')); ?>

							<?php foreach($album as $key=>$row){ 
								if($row->id==$album_id && $key!=0){ ?>
								<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key-1]->id; ?>'" class="cls-nav-back" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_left_arrow.png">
							<?php } } ?>

							<?php foreach($album as $key=>$row){ ?>
								<div class="cls-nav-item <?php if($row->id==$album_id) { ?>currentPage<?php } ?>" onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $row->id; ?>'"><?php echo $key+1; ?></div>
							<?php } ?>

							<?php foreach($album as $key=>$row){ 
								if($row->id==$album_id && $key!=count($album)-1){ ?>
								<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key+1]->id; ?>'" class="cls-nav-next" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_right_arrow.png">
							<?php } } ?>
						</div>
    			</div>
    		</div>
    	</div>

 <div class="row visible-md">
    		<div class="col-sm-6 col-lg-6 col-12 mt60 slideleft">
    			<div class="hidden-sm">
    				<ul id="mycarousel" class="jcarousel-skin-tango" style="display:none;">
    					 <?php 
	                    $album = nggdb::find_album($album_id);
	                    foreach($album->gallery_ids as $gallery_id){
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							$gallery = nggdb::find_gallery( $gallery_id ); 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
	                        ?>
		                	 <li><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"  /></a></li>
	                    <?php } ?>
		            </ul>
    				<img class="khung-bst" src="<?php echo bloginfo('template_url'); ?>/img/slider-left.png" style="width: 470px;margin-left: -125px;margin-top: -215px;display:none;">
    			</div>
    			<div>
	    			<div id="carousel-example-generic-md" data-interval="false" class="carousel slide col-lg-11 col-sm-11 pull-right text-center gallery-sm">
					  <!-- Wrapper for slides -->
					  <div class="carousel-inner">
					  <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i<2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item <?php if($i==2){ ?>active<?php } ?>">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						      <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						      <div class="visible-sm">
						      	<img src="<?php echo $imgpath; ?>">
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
	                    <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i>=2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						       <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						       <div class="visible-sm">
						      	<a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"></a>
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
					  </div>

					  <!-- Controls -->
					  <a class="left carousel-control" href="#carousel-example-generic-md" data-slide="prev">
					    <span class="icon-prev"></span>
					  </a>
					  <a class="right carousel-control" href="#carousel-example-generic-md" data-slide="next">
					    <span class="icon-next"></span>
					  </a>
					</div> 
                </div>
    		</div>
    		<div class="col-sm-6 col-lg-6 col-12 hidden-sm">
    			<div class="col-lg-3 col-sm-3">
    				<img src="<?php echo bloginfo('template_url'); ?>/img/human4.png">
    			</div>
    			<div class="col-lg-1 col-sm-2"></div>
    			<div class="col-lg-8 col-sm-7 mt60 slideright">
    				<ul id="mycarousel2" class="jcarousel-skin-tango" style="display:none;">
		                 <?php 
	                    $album = nggdb::find_album($album_id);
	                    foreach($album->gallery_ids as $gallery_id){
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							$gallery = nggdb::find_gallery( $gallery_id ); 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
	                        ?>
		                	 <li><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"  /></a></li>
	                    <?php } ?>
		            </ul>
    				<img src="<?php echo bloginfo('template_url'); ?>/img/slider-right.png">
    				<div class="cls-bst-nav">
							<?php 
							global $wpdb;
							$album = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->nggalbum",'')); ?>

							<?php foreach($album as $key=>$row){ 
								if($row->id==$album_id && $key!=0){ ?>
								<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key-1]->id; ?>'" class="cls-nav-back" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_left_arrow.png">
							<?php } } ?>

							<?php foreach($album as $key=>$row){ ?>
								<div class="cls-nav-item <?php if($row->id==$album_id) { ?>currentPage<?php } ?>" onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $row->id; ?>'"><?php echo $key+1; ?></div>
							<?php } ?>

							<?php foreach($album as $key=>$row){ 
								if($row->id==$album_id && $key!=count($album)-1){ ?>
								<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key+1]->id; ?>'" class="cls-nav-next" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_right_arrow.png">
							<?php } } ?>
						</div>
    			</div>
    		</div>
    	</div>

<div class="row visible-sm">
    		<div class="col-sm-6 col-lg-6 col-12 mt60 slideleft">
    			<div>
	    			<div id="carousel-example-generic-sm" data-interval="false" class="carousel slide col-lg-11 col-sm-11 pull-right text-center gallery-sm">
	    			<!-- Indicators -->
					  <ol class="carousel-indicators visible-sm">
					  	<?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){ ?>
						    <li data-target="#carousel-example-generic-sm" data-slide-to="<?php echo $i ?>" class="<?php if($i==0){ ?>active<?php } ?>"><?php echo $i+1 ?></li>
	                    <?php $i++; } ?>
					  </ol>
					  <!-- Wrapper for slides -->
					  <div class="carousel-inner">
					  <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i<2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item <?php if($i==2){ ?>active<?php } ?>">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						      <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						      <div class="visible-sm">
						      	<img src="<?php echo $imgpath; ?>">
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
	                    <?php 
	                    $album = nggdb::find_album($album_id);
	                    $i=0;
	                    foreach($album->gallery_ids as $gallery_id){
	                    	if($i>=2){$i++;continue;}
							$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
							 
							if(!empty($results[0]['path']) && !empty($results[0]['filename'])){
								$path = explode('wp-content', $results[0]['path']);
								$imgpath = site_url().'/wp-content'.$path[1].'/'.$results[0]['filename'];
							}else{
								$imgpath = bloginfo('template_url').'/img/no-image-blog-one.png';
							}
							$gallery = nggdb::find_gallery( $gallery_id );
	                        ?>
						    <div class="item">
		    				  <h2 class="pink text-right gallery-text"><a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><?php echo $gallery->title; ?></a></h2>  
						      <p><?php echo $gallery->galdesc; ?></p>
						       <div class="hidden-sm"><button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button></div>
						       <div class="visible-sm">
						      	<a href="<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>"><img src="<?php echo $imgpath; ?>"></a>
						      	<button class="btn btn-custom" onclick="document.location.href='<?php echo site_url() ?>/chi-tiet-bo-suu-tap/<?php echo $gallery->slug ?>'">Xem</button>
						      </div>
						    </div>
	                    <?php $i++; } ?>
					  </div>

					  <!-- Controls -->
					  <a class="left carousel-control" href="#carousel-example-generic-sm" data-slide="prev">
					    <span class="icon-prev"></span>
					  </a>
					  <a class="right carousel-control" href="#carousel-example-generic-sm" data-slide="next">
					    <span class="icon-next"></span>
					  </a>
					</div> 
                </div>
    		</div>
    	</div>
    	<script type="text/javascript">
    	$(document).ready(function(){
		 	$('.visible-lg #mycarousel').jcarousel({
	            wrap: 'circular',
	            scroll: 1,
	            start: 1
	        });
	        $('.visible-lg #mycarousel2').jcarousel({
	            wrap: 'circular',
	            scroll: 1,
	            start: 4
	        });
			$('.gallery .visible-lg  .carousel-control.right').click(function() {
	            $('.gallery .visible-lg  .jcarousel-next-horizontal').click();
	            $('#carousel-example-tag .carousel-control.right').click();
	        });
	        $('.gallery .visible-lg  .carousel-control.left').click(function() {
	            $('.gallery .visible-lg  .jcarousel-prev-horizontal').click();
	            $('#carousel-example-tag .carousel-control.left').click();
	        });
	        $('li[data-target=#carousel-example-generic]').click(function() {
	            var id = $(this).attr('data-slide-to');
	            $('li[data-target=#carousel-example-tag][data-slide-to='+id+']').click();
	        });
	        $('.visible-lg #mycarousel').css('display','');
	        $('.visible-lg #mycarousel2').css('display','');
	        $('.visible-lg .khung-bst').css('display','');

	        $('.visible-md #mycarousel').jcarousel({
	            wrap: 'circular',
	            scroll: 1,
	            start: 1
	        });
	        $('.visible-md #mycarousel2').jcarousel({
	            wrap: 'circular',
	            scroll: 1,
	            start: 4
	        });
			$('.gallery .visible-md .carousel-control.right').click(function() {
	            $('.gallery .visible-md .jcarousel-next-horizontal').click();
	            $('#carousel-example-tag .carousel-control.right').click();
	        });
	        $('.gallery .visible-md .carousel-control.left').click(function() {
	            $('.gallery .visible-md .jcarousel-prev-horizontal').click();
	            $('#carousel-example-tag .carousel-control.left').click();
	        });
	        $('li[data-target=#carousel-example-generic-md]').click(function() {
	            var id = $(this).attr('data-slide-to');
	            $('li[data-target=#carousel-example-tag][data-slide-to='+id+']').click();
	        });
	        $('.visible-md #mycarousel').css('display','');
	        $('.visible-md #mycarousel2').css('display','');
	        $('.visible-md .khung-bst').css('display','');
    	});
		</script>
    </div>
</div>

	<div class="visible-sm nav-bst-sm">
		<img src="<?php echo bloginfo('template_url'); ?>/img/slider-right.png">
		<div class="cls-bst-nav">
			<?php 
			global $wpdb;
			$album = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->nggalbum",'')); ?>

			<?php foreach($album as $key=>$row){ 
				if($row->id==$album_id && $key!=0){ ?>
				<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key-1]->id; ?>'" class="cls-nav-back" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_left_arrow.png">
			<?php } } ?>

			<?php foreach($album as $key=>$row){ ?>
				<div class="cls-nav-item <?php if($row->id==$album_id) { ?>currentPage<?php } ?>" onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $row->id; ?>'"><?php echo $key+1; ?></div>
			<?php } ?>

			<?php foreach($album as $key=>$row){ 
				if($row->id==$album_id && $key!=count($album)-1){ ?>
				<img onclick="document.location.href='<?php echo site_url() ?>/bo-suu-tap/<?php echo $album[$key+1]->id; ?>'" class="cls-nav-next" height="30px" width="12px" src="<?php echo bloginfo('template_url'); ?>/img/bst_right_arrow.png">
			<?php } } ?>
		</div> 
	</div>
<div id="carousel-example-tag" data-interval="false" class="visible-sm carousel slide col-lg-12 col-sm-12">
  <!-- Indicators -->
  <ol class="carousel-indicators" style="display:none;">
  	<?php 
    $album = nggdb::find_album($album_id);
    $i=0;
    foreach($album->gallery_ids as $gallery_id){ ?>
	    <li data-target="#carousel-example-tag" data-slide-to="<?php echo $i ?>" class="<?php if($i==0){ ?>active<?php } ?>"><?php echo $i+1 ?></li>
    <?php $i++; } ?>
  </ol>
  <!-- Wrapper for slides -->
  <div class="carousel-inner">
	<?php 
	$i=0;
    $album = nggdb::find_album($album_id);
    foreach($album->gallery_ids as $gallery_id){ ?>  
	    <div class="item <?php if($i==0){ ?>active<?php } ?>">
		 <div class="tag-slider" style="margin-bottom:10px;">
			Tags:   
				<?php $tags = wp_get_object_terms($gallery_id,'ngg_tag') ?>
				<?php foreach ( $tags as $tag ) : ?>
				   <a href="<?php bloginfo('url'); ?>/tag/<?php echo $tag->slug; ?>"><?php echo $tag->name; ?></a>, 
				<?php endforeach; ?>
		</div>
	    </div>
    <?php $i++; } ?>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" style="display:none;" href="#carousel-example-tag" data-slide="prev">
    <span class="icon-prev"></span>
  </a>
  <a class="right carousel-control" style="display:none;" href="#carousel-example-tag" data-slide="next">
    <span class="icon-next"></span>
  </a>
</div>
</div>
<style type="text/css">
	.header{
		margin-bottom: 70px;
	}
@media (max-width: 767px){
	.nav-bst-sm {
		display: none !important;
	}
}
</style>
<?php get_footer() ?>